{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "该实现不包含k折交叉检验 以及 动态可视化\n",
    "建立一个简单的线性模型，提供数据健全性检查，也作为baseline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "import pandas as pd\n",
    "from torch import nn\n",
    "from d2l import torch as d2l\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_feature = pd.read_csv('../data/processed/train_feature.csv')\n",
    "train_label = pd.read_csv('../data/processed/train_label.csv')\n",
    "\n",
    "# 测试集没有label的，将训练集划分一块作为验证集\n",
    "test_feature = pd.read_csv('../data/processed/test_feature.csv')\n",
    "\n",
    "# bool 类型数据要转为int 才可以变为tensor\n",
    "bool_cols = train_feature.dtypes[train_feature.dtypes == 'bool'].index\n",
    "train_feature[bool_cols] = train_feature[bool_cols].astype(int)\n",
    "test_feature[bool_cols] = test_feature[bool_cols].astype(int)\n",
    "\n",
    "train_feature = torch.tensor(train_feature.values, dtype=torch.float32)\n",
    "train_label = torch.tensor(train_label.values, dtype=torch.float32)\n",
    "test_feature = torch.tensor(test_feature.values, dtype=torch.float32)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "loss = nn.BCEWithLogitsLoss()\n",
    "in_features = train_feature.shape[1]\n",
    "\n",
    "def init_weights(m):\n",
    "    if type(m) == nn.Linear:\n",
    "        nn.init.normal_(m.weight, std=0.01)\n",
    "\n",
    "def get_net(dropout1):\n",
    "    net = nn.Sequential(nn.Linear(in_features, 256),\n",
    "                        nn.ReLU(),\n",
    "                        nn.Dropout(dropout1),\n",
    "                        nn.Linear(256, 1))\n",
    "    \n",
    "    net.apply(init_weights)\n",
    "    return net\n",
    "\n",
    "def accuracy_cal(net, feature, label):\n",
    "    net.eval()\n",
    "    probality = torch.sigmoid(net(feature))\n",
    "    prediction = (probality>=0.5).long()\n",
    "    # print(f'predict shape is {prediction.shape} and label shape is {label.shape}')\n",
    "    correct_predition = (prediction == label).sum().item()\n",
    "    return correct_predition/len(label)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "def train(net, train_feature, train_label, test_feature, test_label, num_epoch, learn_rate, weight_decay, batch_size, loss):\n",
    "    train_iter = d2l.load_array((train_feature, train_label), batch_size)\n",
    "    optimizer = torch.optim.Adam(net.parameters(), lr=learn_rate, weight_decay=weight_decay)\n",
    "    train_loss, test_loss, train_acc, test_acc = [], [], [], []\n",
    "\n",
    "    for epoch in range(num_epoch):\n",
    "        epoch_loss = []\n",
    "        for X, y in train_iter:\n",
    "            net.train()\n",
    "            optimizer.zero_grad()\n",
    "            l = loss(net(X), y)\n",
    "            l.backward()\n",
    "            optimizer.step()\n",
    "            epoch_loss.append(l.item())\n",
    "        \n",
    "        train_acc.append(accuracy_cal(net, train_feature, train_label))\n",
    "        test_acc.append(accuracy_cal(net, test_feature, test_label))\n",
    "        train_loss.append(np.mean(epoch_loss))\n",
    "    return train_acc, test_acc, train_loss\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "net = get_net(0.2)\n",
    "n_train = train_label.shape[0] // 3 * 2\n",
    "# print('train feature shape is ', train_feature.shape)\n",
    "train_data = train_feature[:n_train, :]\n",
    "train_value = train_label[:n_train, :]\n",
    "valid_data = train_feature[ n_train:, :]\n",
    "valid_value = train_label[n_train:, :]\n",
    "\n",
    "# train_acc, test_acc = train(net, *train_data[0],train_data[1], *valid_data[0], valid_data[1], 100, 1, 0, 64)\n",
    "train_acc, test_acc, train_loss = train(net, train_data, train_value, valid_data, valid_value, 100, 0.02, 0, 64, loss)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"255.825pt\" height=\"187.155469pt\" viewBox=\"0 0 255.825 187.155469\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2025-01-15T21:17:34.391236</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 187.155469 \n",
       "L 255.825 187.155469 \n",
       "L 255.825 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 43.78125 149.599219 \n",
       "L 239.08125 149.599219 \n",
       "L 239.08125 10.999219 \n",
       "L 43.78125 10.999219 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path d=\"M 81.263068 149.599219 \n",
       "L 81.263068 10.999219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_2\">\n",
       "      <defs>\n",
       "       <path id=\"m856d9eb778\" d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m856d9eb778\" x=\"81.263068\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- 20 -->\n",
       "      <g transform=\"translate(74.900568 164.197656) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
       "L 3431 531 \n",
       "L 3431 0 \n",
       "L 469 0 \n",
       "L 469 531 \n",
       "Q 828 903 1448 1529 \n",
       "Q 2069 2156 2228 2338 \n",
       "Q 2531 2678 2651 2914 \n",
       "Q 2772 3150 2772 3378 \n",
       "Q 2772 3750 2511 3984 \n",
       "Q 2250 4219 1831 4219 \n",
       "Q 1534 4219 1204 4116 \n",
       "Q 875 4013 500 3803 \n",
       "L 500 4441 \n",
       "Q 881 4594 1212 4672 \n",
       "Q 1544 4750 1819 4750 \n",
       "Q 2544 4750 2975 4387 \n",
       "Q 3406 4025 3406 3419 \n",
       "Q 3406 3131 3298 2873 \n",
       "Q 3191 2616 2906 2266 \n",
       "Q 2828 2175 2409 1742 \n",
       "Q 1991 1309 1228 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path d=\"M 120.717614 149.599219 \n",
       "L 120.717614 10.999219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m856d9eb778\" x=\"120.717614\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- 40 -->\n",
       "      <g transform=\"translate(114.355114 164.197656) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \n",
       "L 825 1625 \n",
       "L 2419 1625 \n",
       "L 2419 4116 \n",
       "z\n",
       "M 2253 4666 \n",
       "L 3047 4666 \n",
       "L 3047 1625 \n",
       "L 3713 1625 \n",
       "L 3713 1100 \n",
       "L 3047 1100 \n",
       "L 3047 0 \n",
       "L 2419 0 \n",
       "L 2419 1100 \n",
       "L 313 1100 \n",
       "L 313 1709 \n",
       "L 2253 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-34\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path d=\"M 160.172159 149.599219 \n",
       "L 160.172159 10.999219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m856d9eb778\" x=\"160.172159\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- 60 -->\n",
       "      <g transform=\"translate(153.809659 164.197656) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-36\" d=\"M 2113 2584 \n",
       "Q 1688 2584 1439 2293 \n",
       "Q 1191 2003 1191 1497 \n",
       "Q 1191 994 1439 701 \n",
       "Q 1688 409 2113 409 \n",
       "Q 2538 409 2786 701 \n",
       "Q 3034 994 3034 1497 \n",
       "Q 3034 2003 2786 2293 \n",
       "Q 2538 2584 2113 2584 \n",
       "z\n",
       "M 3366 4563 \n",
       "L 3366 3988 \n",
       "Q 3128 4100 2886 4159 \n",
       "Q 2644 4219 2406 4219 \n",
       "Q 1781 4219 1451 3797 \n",
       "Q 1122 3375 1075 2522 \n",
       "Q 1259 2794 1537 2939 \n",
       "Q 1816 3084 2150 3084 \n",
       "Q 2853 3084 3261 2657 \n",
       "Q 3669 2231 3669 1497 \n",
       "Q 3669 778 3244 343 \n",
       "Q 2819 -91 2113 -91 \n",
       "Q 1303 -91 875 529 \n",
       "Q 447 1150 447 2328 \n",
       "Q 447 3434 972 4092 \n",
       "Q 1497 4750 2381 4750 \n",
       "Q 2619 4750 2861 4703 \n",
       "Q 3103 4656 3366 4563 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-36\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 199.626705 149.599219 \n",
       "L 199.626705 10.999219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m856d9eb778\" x=\"199.626705\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- 80 -->\n",
       "      <g transform=\"translate(193.264205 164.197656) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-38\" d=\"M 2034 2216 \n",
       "Q 1584 2216 1326 1975 \n",
       "Q 1069 1734 1069 1313 \n",
       "Q 1069 891 1326 650 \n",
       "Q 1584 409 2034 409 \n",
       "Q 2484 409 2743 651 \n",
       "Q 3003 894 3003 1313 \n",
       "Q 3003 1734 2745 1975 \n",
       "Q 2488 2216 2034 2216 \n",
       "z\n",
       "M 1403 2484 \n",
       "Q 997 2584 770 2862 \n",
       "Q 544 3141 544 3541 \n",
       "Q 544 4100 942 4425 \n",
       "Q 1341 4750 2034 4750 \n",
       "Q 2731 4750 3128 4425 \n",
       "Q 3525 4100 3525 3541 \n",
       "Q 3525 3141 3298 2862 \n",
       "Q 3072 2584 2669 2484 \n",
       "Q 3125 2378 3379 2068 \n",
       "Q 3634 1759 3634 1313 \n",
       "Q 3634 634 3220 271 \n",
       "Q 2806 -91 2034 -91 \n",
       "Q 1263 -91 848 271 \n",
       "Q 434 634 434 1313 \n",
       "Q 434 1759 690 2068 \n",
       "Q 947 2378 1403 2484 \n",
       "z\n",
       "M 1172 3481 \n",
       "Q 1172 3119 1398 2916 \n",
       "Q 1625 2713 2034 2713 \n",
       "Q 2441 2713 2670 2916 \n",
       "Q 2900 3119 2900 3481 \n",
       "Q 2900 3844 2670 4047 \n",
       "Q 2441 4250 2034 4250 \n",
       "Q 1625 4250 1398 4047 \n",
       "Q 1172 3844 1172 3481 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-38\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 239.08125 149.599219 \n",
       "L 239.08125 10.999219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m856d9eb778\" x=\"239.08125\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- 100 -->\n",
       "      <g transform=\"translate(229.5375 164.197656) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_6\">\n",
       "     <!-- epoch -->\n",
       "     <g transform=\"translate(126.203125 177.875781) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \n",
       "L 3597 1613 \n",
       "L 953 1613 \n",
       "Q 991 1019 1311 708 \n",
       "Q 1631 397 2203 397 \n",
       "Q 2534 397 2845 478 \n",
       "Q 3156 559 3463 722 \n",
       "L 3463 178 \n",
       "Q 3153 47 2828 -22 \n",
       "Q 2503 -91 2169 -91 \n",
       "Q 1331 -91 842 396 \n",
       "Q 353 884 353 1716 \n",
       "Q 353 2575 817 3079 \n",
       "Q 1281 3584 2069 3584 \n",
       "Q 2775 3584 3186 3129 \n",
       "Q 3597 2675 3597 1894 \n",
       "z\n",
       "M 3022 2063 \n",
       "Q 3016 2534 2758 2815 \n",
       "Q 2500 3097 2075 3097 \n",
       "Q 1594 3097 1305 2825 \n",
       "Q 1016 2553 972 2059 \n",
       "L 3022 2063 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-70\" d=\"M 1159 525 \n",
       "L 1159 -1331 \n",
       "L 581 -1331 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2969 \n",
       "Q 1341 3281 1617 3432 \n",
       "Q 1894 3584 2278 3584 \n",
       "Q 2916 3584 3314 3078 \n",
       "Q 3713 2572 3713 1747 \n",
       "Q 3713 922 3314 415 \n",
       "Q 2916 -91 2278 -91 \n",
       "Q 1894 -91 1617 61 \n",
       "Q 1341 213 1159 525 \n",
       "z\n",
       "M 3116 1747 \n",
       "Q 3116 2381 2855 2742 \n",
       "Q 2594 3103 2138 3103 \n",
       "Q 1681 3103 1420 2742 \n",
       "Q 1159 2381 1159 1747 \n",
       "Q 1159 1113 1420 752 \n",
       "Q 1681 391 2138 391 \n",
       "Q 2594 391 2855 752 \n",
       "Q 3116 1113 3116 1747 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-6f\" d=\"M 1959 3097 \n",
       "Q 1497 3097 1228 2736 \n",
       "Q 959 2375 959 1747 \n",
       "Q 959 1119 1226 758 \n",
       "Q 1494 397 1959 397 \n",
       "Q 2419 397 2687 759 \n",
       "Q 2956 1122 2956 1747 \n",
       "Q 2956 2369 2687 2733 \n",
       "Q 2419 3097 1959 3097 \n",
       "z\n",
       "M 1959 3584 \n",
       "Q 2709 3584 3137 3096 \n",
       "Q 3566 2609 3566 1747 \n",
       "Q 3566 888 3137 398 \n",
       "Q 2709 -91 1959 -91 \n",
       "Q 1206 -91 779 398 \n",
       "Q 353 888 353 1747 \n",
       "Q 353 2609 779 3096 \n",
       "Q 1206 3584 1959 3584 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \n",
       "L 3122 2828 \n",
       "Q 2878 2963 2633 3030 \n",
       "Q 2388 3097 2138 3097 \n",
       "Q 1578 3097 1268 2742 \n",
       "Q 959 2388 959 1747 \n",
       "Q 959 1106 1268 751 \n",
       "Q 1578 397 2138 397 \n",
       "Q 2388 397 2633 464 \n",
       "Q 2878 531 3122 666 \n",
       "L 3122 134 \n",
       "Q 2881 22 2623 -34 \n",
       "Q 2366 -91 2075 -91 \n",
       "Q 1284 -91 818 406 \n",
       "Q 353 903 353 1747 \n",
       "Q 353 2603 823 3093 \n",
       "Q 1294 3584 2113 3584 \n",
       "Q 2378 3584 2631 3529 \n",
       "Q 2884 3475 3122 3366 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-68\" d=\"M 3513 2113 \n",
       "L 3513 0 \n",
       "L 2938 0 \n",
       "L 2938 2094 \n",
       "Q 2938 2591 2744 2837 \n",
       "Q 2550 3084 2163 3084 \n",
       "Q 1697 3084 1428 2787 \n",
       "Q 1159 2491 1159 1978 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 4863 \n",
       "L 1159 4863 \n",
       "L 1159 2956 \n",
       "Q 1366 3272 1645 3428 \n",
       "Q 1925 3584 2291 3584 \n",
       "Q 2894 3584 3203 3211 \n",
       "Q 3513 2838 3513 2113 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-65\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-70\" x=\"61.523438\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6f\" x=\"125\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-63\" x=\"186.181641\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-68\" x=\"241.162109\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 43.78125 149.599219 \n",
       "L 239.08125 149.599219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\">\n",
       "      <defs>\n",
       "       <path id=\"mb77959ff09\" d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mb77959ff09\" x=\"43.78125\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- 0.0 -->\n",
       "      <g transform=\"translate(20.878125 153.398438) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-2e\" d=\"M 684 794 \n",
       "L 1344 794 \n",
       "L 1344 0 \n",
       "L 684 0 \n",
       "L 684 794 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path d=\"M 43.78125 121.879219 \n",
       "L 239.08125 121.879219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mb77959ff09\" x=\"43.78125\" y=\"121.879219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- 0.2 -->\n",
       "      <g transform=\"translate(20.878125 125.678438) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path d=\"M 43.78125 94.159219 \n",
       "L 239.08125 94.159219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mb77959ff09\" x=\"43.78125\" y=\"94.159219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- 0.4 -->\n",
       "      <g transform=\"translate(20.878125 97.958438) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-34\" x=\"95.410156\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <path d=\"M 43.78125 66.439219 \n",
       "L 239.08125 66.439219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mb77959ff09\" x=\"43.78125\" y=\"66.439219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- 0.6 -->\n",
       "      <g transform=\"translate(20.878125 70.238437) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-36\" x=\"95.410156\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <path d=\"M 43.78125 38.719219 \n",
       "L 239.08125 38.719219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_20\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mb77959ff09\" x=\"43.78125\" y=\"38.719219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_11\">\n",
       "      <!-- 0.8 -->\n",
       "      <g transform=\"translate(20.878125 42.518438) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-38\" x=\"95.410156\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <path d=\"M 43.78125 10.999219 \n",
       "L 239.08125 10.999219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_22\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mb77959ff09\" x=\"43.78125\" y=\"10.999219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- 1.0 -->\n",
       "      <g transform=\"translate(20.878125 14.798438) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_13\">\n",
       "     <!-- accuracy -->\n",
       "     <g transform=\"translate(14.798438 102.858594) rotate(-90) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-61\" d=\"M 2194 1759 \n",
       "Q 1497 1759 1228 1600 \n",
       "Q 959 1441 959 1056 \n",
       "Q 959 750 1161 570 \n",
       "Q 1363 391 1709 391 \n",
       "Q 2188 391 2477 730 \n",
       "Q 2766 1069 2766 1631 \n",
       "L 2766 1759 \n",
       "L 2194 1759 \n",
       "z\n",
       "M 3341 1997 \n",
       "L 3341 0 \n",
       "L 2766 0 \n",
       "L 2766 531 \n",
       "Q 2569 213 2275 61 \n",
       "Q 1981 -91 1556 -91 \n",
       "Q 1019 -91 701 211 \n",
       "Q 384 513 384 1019 \n",
       "Q 384 1609 779 1909 \n",
       "Q 1175 2209 1959 2209 \n",
       "L 2766 2209 \n",
       "L 2766 2266 \n",
       "Q 2766 2663 2505 2880 \n",
       "Q 2244 3097 1772 3097 \n",
       "Q 1472 3097 1187 3025 \n",
       "Q 903 2953 641 2809 \n",
       "L 641 3341 \n",
       "Q 956 3463 1253 3523 \n",
       "Q 1550 3584 1831 3584 \n",
       "Q 2591 3584 2966 3190 \n",
       "Q 3341 2797 3341 1997 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-75\" d=\"M 544 1381 \n",
       "L 544 3500 \n",
       "L 1119 3500 \n",
       "L 1119 1403 \n",
       "Q 1119 906 1312 657 \n",
       "Q 1506 409 1894 409 \n",
       "Q 2359 409 2629 706 \n",
       "Q 2900 1003 2900 1516 \n",
       "L 2900 3500 \n",
       "L 3475 3500 \n",
       "L 3475 0 \n",
       "L 2900 0 \n",
       "L 2900 538 \n",
       "Q 2691 219 2414 64 \n",
       "Q 2138 -91 1772 -91 \n",
       "Q 1169 -91 856 284 \n",
       "Q 544 659 544 1381 \n",
       "z\n",
       "M 1991 3584 \n",
       "L 1991 3584 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-72\" d=\"M 2631 2963 \n",
       "Q 2534 3019 2420 3045 \n",
       "Q 2306 3072 2169 3072 \n",
       "Q 1681 3072 1420 2755 \n",
       "Q 1159 2438 1159 1844 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2956 \n",
       "Q 1341 3275 1631 3429 \n",
       "Q 1922 3584 2338 3584 \n",
       "Q 2397 3584 2469 3576 \n",
       "Q 2541 3569 2628 3553 \n",
       "L 2631 2963 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-79\" d=\"M 2059 -325 \n",
       "Q 1816 -950 1584 -1140 \n",
       "Q 1353 -1331 966 -1331 \n",
       "L 506 -1331 \n",
       "L 506 -850 \n",
       "L 844 -850 \n",
       "Q 1081 -850 1212 -737 \n",
       "Q 1344 -625 1503 -206 \n",
       "L 1606 56 \n",
       "L 191 3500 \n",
       "L 800 3500 \n",
       "L 1894 763 \n",
       "L 2988 3500 \n",
       "L 3597 3500 \n",
       "L 2059 -325 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-61\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-63\" x=\"61.279297\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-63\" x=\"116.259766\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-75\" x=\"171.240234\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-72\" x=\"234.619141\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-61\" x=\"275.732422\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-63\" x=\"337.011719\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-79\" x=\"391.992188\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_23\">\n",
       "    <path d=\"M 43.78125 39.232552 \n",
       "L 45.753977 36.899219 \n",
       "L 47.726705 36.899219 \n",
       "L 49.699432 35.965885 \n",
       "L 51.672159 35.732552 \n",
       "L 53.644886 36.899219 \n",
       "L 55.617614 35.265885 \n",
       "L 57.590341 36.665885 \n",
       "L 59.563068 34.565885 \n",
       "L 61.535795 34.099219 \n",
       "L 63.508523 34.565885 \n",
       "L 65.48125 34.799219 \n",
       "L 67.453977 33.399219 \n",
       "L 69.426705 34.099219 \n",
       "L 71.399432 33.865885 \n",
       "L 73.372159 34.799219 \n",
       "L 75.344886 34.099219 \n",
       "L 77.317614 33.865885 \n",
       "L 79.290341 34.099219 \n",
       "L 81.263068 32.465885 \n",
       "L 83.235795 33.165885 \n",
       "L 85.208523 31.532552 \n",
       "L 87.18125 31.299219 \n",
       "L 89.153977 32.699219 \n",
       "L 91.126705 33.399219 \n",
       "L 93.099432 33.865885 \n",
       "L 95.072159 33.165885 \n",
       "L 97.044886 32.699219 \n",
       "L 99.017614 31.299219 \n",
       "L 100.990341 32.232552 \n",
       "L 102.963068 31.299219 \n",
       "L 104.935795 32.232552 \n",
       "L 106.908523 32.465885 \n",
       "L 108.88125 32.465885 \n",
       "L 110.853977 30.832552 \n",
       "L 112.826705 31.299219 \n",
       "L 114.799432 31.299219 \n",
       "L 116.772159 31.999219 \n",
       "L 118.744886 31.765885 \n",
       "L 120.717614 31.299219 \n",
       "L 122.690341 31.532552 \n",
       "L 124.663068 30.599219 \n",
       "L 126.635795 30.832552 \n",
       "L 128.608523 30.599219 \n",
       "L 130.58125 30.365885 \n",
       "L 132.553977 29.665885 \n",
       "L 134.526705 31.299219 \n",
       "L 136.499432 30.599219 \n",
       "L 138.472159 30.365885 \n",
       "L 140.444886 31.065885 \n",
       "L 142.417614 31.299219 \n",
       "L 144.390341 32.232552 \n",
       "L 146.363068 31.299219 \n",
       "L 148.335795 30.365885 \n",
       "L 150.308523 30.832552 \n",
       "L 152.28125 30.132552 \n",
       "L 154.253977 30.832552 \n",
       "L 156.226705 30.132552 \n",
       "L 158.199432 30.599219 \n",
       "L 160.172159 30.832552 \n",
       "L 162.144886 29.199219 \n",
       "L 164.117614 29.665885 \n",
       "L 166.090341 30.365885 \n",
       "L 168.063068 31.299219 \n",
       "L 170.035795 30.365885 \n",
       "L 172.008523 30.599219 \n",
       "L 173.98125 30.599219 \n",
       "L 175.953977 30.599219 \n",
       "L 177.926705 30.132552 \n",
       "L 179.899432 31.065885 \n",
       "L 181.872159 29.199219 \n",
       "L 183.844886 30.365885 \n",
       "L 185.817614 30.599219 \n",
       "L 187.790341 30.365885 \n",
       "L 189.763068 29.665885 \n",
       "L 191.735795 30.832552 \n",
       "L 193.708523 32.232552 \n",
       "L 195.68125 30.132552 \n",
       "L 197.653977 30.599219 \n",
       "L 199.626705 30.132552 \n",
       "L 201.599432 30.365885 \n",
       "L 203.572159 29.432552 \n",
       "L 205.544886 30.132552 \n",
       "L 207.517614 30.599219 \n",
       "L 209.490341 29.899219 \n",
       "L 211.463068 29.665885 \n",
       "L 213.435795 31.299219 \n",
       "L 215.408523 30.132552 \n",
       "L 217.38125 29.199219 \n",
       "L 219.353977 29.899219 \n",
       "L 221.326705 30.132552 \n",
       "L 223.299432 28.965885 \n",
       "L 225.272159 29.199219 \n",
       "L 227.244886 28.032552 \n",
       "L 229.217614 30.132552 \n",
       "L 231.190341 32.699219 \n",
       "L 233.163068 28.499219 \n",
       "L 235.135795 28.499219 \n",
       "L 237.108523 28.965885 \n",
       "L 239.08125 28.499219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_24\">\n",
       "    <path d=\"M 43.78125 37.132552 \n",
       "L 45.753977 34.332552 \n",
       "L 47.726705 35.265885 \n",
       "L 49.699432 36.665885 \n",
       "L 51.672159 32.465885 \n",
       "L 53.644886 35.732552 \n",
       "L 55.617614 34.799219 \n",
       "L 57.590341 31.532552 \n",
       "L 59.563068 33.865885 \n",
       "L 61.535795 30.132552 \n",
       "L 63.508523 33.399219 \n",
       "L 65.48125 30.599219 \n",
       "L 67.453977 32.465885 \n",
       "L 69.426705 33.399219 \n",
       "L 71.399432 32.932552 \n",
       "L 73.372159 31.065885 \n",
       "L 75.344886 30.132552 \n",
       "L 77.317614 29.665885 \n",
       "L 79.290341 30.132552 \n",
       "L 81.263068 32.932552 \n",
       "L 83.235795 31.065885 \n",
       "L 85.208523 30.132552 \n",
       "L 87.18125 29.665885 \n",
       "L 89.153977 31.065885 \n",
       "L 91.126705 30.132552 \n",
       "L 93.099432 33.865885 \n",
       "L 95.072159 32.465885 \n",
       "L 97.044886 34.332552 \n",
       "L 99.017614 31.065885 \n",
       "L 100.990341 31.532552 \n",
       "L 102.963068 32.465885 \n",
       "L 104.935795 31.532552 \n",
       "L 106.908523 31.065885 \n",
       "L 108.88125 31.532552 \n",
       "L 110.853977 31.532552 \n",
       "L 112.826705 31.999219 \n",
       "L 114.799432 31.065885 \n",
       "L 116.772159 30.599219 \n",
       "L 118.744886 30.132552 \n",
       "L 120.717614 33.865885 \n",
       "L 122.690341 31.999219 \n",
       "L 124.663068 33.399219 \n",
       "L 126.635795 34.799219 \n",
       "L 128.608523 30.599219 \n",
       "L 130.58125 30.599219 \n",
       "L 132.553977 31.065885 \n",
       "L 134.526705 31.532552 \n",
       "L 136.499432 31.532552 \n",
       "L 138.472159 36.199219 \n",
       "L 140.444886 34.799219 \n",
       "L 142.417614 33.399219 \n",
       "L 144.390341 31.999219 \n",
       "L 146.363068 32.932552 \n",
       "L 148.335795 31.065885 \n",
       "L 150.308523 34.799219 \n",
       "L 152.28125 33.399219 \n",
       "L 154.253977 34.332552 \n",
       "L 156.226705 34.799219 \n",
       "L 158.199432 33.399219 \n",
       "L 160.172159 33.399219 \n",
       "L 162.144886 34.799219 \n",
       "L 164.117614 33.399219 \n",
       "L 166.090341 35.265885 \n",
       "L 168.063068 31.999219 \n",
       "L 170.035795 32.465885 \n",
       "L 172.008523 32.465885 \n",
       "L 173.98125 33.399219 \n",
       "L 175.953977 32.932552 \n",
       "L 177.926705 34.799219 \n",
       "L 179.899432 33.865885 \n",
       "L 181.872159 34.332552 \n",
       "L 183.844886 33.399219 \n",
       "L 185.817614 33.399219 \n",
       "L 187.790341 31.999219 \n",
       "L 189.763068 32.465885 \n",
       "L 191.735795 35.732552 \n",
       "L 193.708523 33.399219 \n",
       "L 195.68125 32.932552 \n",
       "L 197.653977 33.865885 \n",
       "L 199.626705 32.932552 \n",
       "L 201.599432 32.932552 \n",
       "L 203.572159 33.399219 \n",
       "L 205.544886 32.932552 \n",
       "L 207.517614 31.999219 \n",
       "L 209.490341 31.999219 \n",
       "L 211.463068 32.465885 \n",
       "L 213.435795 33.865885 \n",
       "L 215.408523 32.932552 \n",
       "L 217.38125 32.465885 \n",
       "L 219.353977 33.399219 \n",
       "L 221.326705 31.999219 \n",
       "L 223.299432 32.932552 \n",
       "L 225.272159 32.932552 \n",
       "L 227.244886 31.999219 \n",
       "L 229.217614 30.599219 \n",
       "L 231.190341 34.799219 \n",
       "L 233.163068 31.532552 \n",
       "L 235.135795 32.932552 \n",
       "L 237.108523 32.465885 \n",
       "L 239.08125 31.999219 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke-dasharray: 5.55,2.4; stroke-dashoffset: 0; stroke: #bf00bf; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_25\">\n",
       "    <path d=\"M 43.78125 75.059573 \n",
       "L 45.753977 85.796949 \n",
       "L 47.726705 86.947099 \n",
       "L 49.699432 90.895907 \n",
       "L 51.672159 91.023167 \n",
       "L 53.644886 89.853141 \n",
       "L 55.617614 92.281699 \n",
       "L 57.590341 89.950379 \n",
       "L 59.563068 92.45582 \n",
       "L 61.535795 88.623547 \n",
       "L 63.508523 90.94152 \n",
       "L 65.48125 91.860259 \n",
       "L 67.453977 89.418132 \n",
       "L 69.426705 92.464604 \n",
       "L 71.399432 92.133268 \n",
       "L 73.372159 88.812698 \n",
       "L 75.344886 91.295557 \n",
       "L 77.317614 92.499323 \n",
       "L 79.290341 94.853126 \n",
       "L 81.263068 96.167608 \n",
       "L 83.235795 93.635604 \n",
       "L 85.208523 99.035792 \n",
       "L 87.18125 98.026771 \n",
       "L 89.153977 96.481433 \n",
       "L 91.126705 93.467031 \n",
       "L 93.099432 92.325151 \n",
       "L 95.072159 96.145277 \n",
       "L 97.044886 95.768489 \n",
       "L 99.017614 98.827924 \n",
       "L 100.990341 96.234681 \n",
       "L 102.963068 96.628944 \n",
       "L 104.935795 98.257956 \n",
       "L 106.908523 98.853565 \n",
       "L 108.88125 100.898977 \n",
       "L 110.853977 99.083529 \n",
       "L 112.826705 96.483156 \n",
       "L 114.799432 99.084048 \n",
       "L 116.772159 94.207015 \n",
       "L 118.744886 100.229177 \n",
       "L 120.717614 100.423107 \n",
       "L 122.690341 97.811574 \n",
       "L 124.663068 101.143488 \n",
       "L 126.635795 97.09387 \n",
       "L 128.608523 100.430648 \n",
       "L 130.58125 96.772031 \n",
       "L 132.553977 101.30985 \n",
       "L 134.526705 101.384543 \n",
       "L 136.499432 100.008801 \n",
       "L 138.472159 99.467775 \n",
       "L 140.444886 101.529771 \n",
       "L 142.417614 99.717865 \n",
       "L 144.390341 100.730812 \n",
       "L 146.363068 95.05372 \n",
       "L 148.335795 97.98726 \n",
       "L 150.308523 99.757953 \n",
       "L 152.28125 99.726281 \n",
       "L 154.253977 103.210935 \n",
       "L 156.226705 98.070804 \n",
       "L 158.199432 100.0408 \n",
       "L 160.172159 100.853957 \n",
       "L 162.144886 102.016695 \n",
       "L 164.117614 101.471738 \n",
       "L 166.090341 103.80795 \n",
       "L 168.063068 98.819931 \n",
       "L 170.035795 97.598336 \n",
       "L 172.008523 99.764879 \n",
       "L 173.98125 100.371353 \n",
       "L 175.953977 99.55511 \n",
       "L 177.926705 99.709432 \n",
       "L 179.899432 96.932686 \n",
       "L 181.872159 99.057794 \n",
       "L 183.844886 97.257473 \n",
       "L 185.817614 101.958561 \n",
       "L 187.790341 100.067838 \n",
       "L 189.763068 100.730562 \n",
       "L 191.735795 101.656034 \n",
       "L 193.708523 102.467593 \n",
       "L 195.68125 100.338082 \n",
       "L 197.653977 102.411616 \n",
       "L 199.626705 103.107141 \n",
       "L 201.599432 104.18792 \n",
       "L 203.572159 100.211089 \n",
       "L 205.544886 104.28708 \n",
       "L 207.517614 100.848893 \n",
       "L 209.490341 101.901703 \n",
       "L 211.463068 99.876242 \n",
       "L 213.435795 101.985724 \n",
       "L 215.408523 103.17093 \n",
       "L 217.38125 100.287032 \n",
       "L 219.353977 99.595291 \n",
       "L 221.326705 103.03232 \n",
       "L 223.299432 101.530828 \n",
       "L 225.272159 103.091266 \n",
       "L 227.244886 100.327017 \n",
       "L 229.217614 100.612841 \n",
       "L 231.190341 105.248671 \n",
       "L 233.163068 102.91454 \n",
       "L 235.135795 103.554303 \n",
       "L 237.108523 103.525551 \n",
       "L 239.08125 102.747698 \n",
       "\" clip-path=\"url(#pf768b3c47b)\" style=\"fill: none; stroke-dasharray: 9.6,2.4,1.5,2.4; stroke-dashoffset: 0; stroke: #008000; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 43.78125 149.599219 \n",
       "L 43.78125 10.999219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 239.08125 149.599219 \n",
       "L 239.08125 10.999219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 43.78125 149.599219 \n",
       "L 239.08125 149.599219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 43.78125 10.999219 \n",
       "L 239.08125 10.999219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"legend_1\">\n",
       "    <g id=\"patch_7\">\n",
       "     <path d=\"M 50.78125 144.599219 \n",
       "L 106.732812 144.599219 \n",
       "Q 108.732812 144.599219 108.732812 142.599219 \n",
       "L 108.732812 99.564844 \n",
       "Q 108.732812 97.564844 106.732812 97.564844 \n",
       "L 50.78125 97.564844 \n",
       "Q 48.78125 97.564844 48.78125 99.564844 \n",
       "L 48.78125 142.599219 \n",
       "Q 48.78125 144.599219 50.78125 144.599219 \n",
       "z\n",
       "\" style=\"fill: #ffffff; opacity: 0.8; stroke: #cccccc; stroke-linejoin: miter\"/>\n",
       "    </g>\n",
       "    <g id=\"line2d_26\">\n",
       "     <path d=\"M 52.78125 105.663281 \n",
       "L 62.78125 105.663281 \n",
       "L 72.78125 105.663281 \n",
       "\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "    </g>\n",
       "    <g id=\"text_14\">\n",
       "     <!-- train -->\n",
       "     <g transform=\"translate(80.78125 109.163281) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-74\" d=\"M 1172 4494 \n",
       "L 1172 3500 \n",
       "L 2356 3500 \n",
       "L 2356 3053 \n",
       "L 1172 3053 \n",
       "L 1172 1153 \n",
       "Q 1172 725 1289 603 \n",
       "Q 1406 481 1766 481 \n",
       "L 2356 481 \n",
       "L 2356 0 \n",
       "L 1766 0 \n",
       "Q 1100 0 847 248 \n",
       "Q 594 497 594 1153 \n",
       "L 594 3053 \n",
       "L 172 3053 \n",
       "L 172 3500 \n",
       "L 594 3500 \n",
       "L 594 4494 \n",
       "L 1172 4494 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-69\" d=\"M 603 3500 \n",
       "L 1178 3500 \n",
       "L 1178 0 \n",
       "L 603 0 \n",
       "L 603 3500 \n",
       "z\n",
       "M 603 4863 \n",
       "L 1178 4863 \n",
       "L 1178 4134 \n",
       "L 603 4134 \n",
       "L 603 4863 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-6e\" d=\"M 3513 2113 \n",
       "L 3513 0 \n",
       "L 2938 0 \n",
       "L 2938 2094 \n",
       "Q 2938 2591 2744 2837 \n",
       "Q 2550 3084 2163 3084 \n",
       "Q 1697 3084 1428 2787 \n",
       "Q 1159 2491 1159 1978 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2956 \n",
       "Q 1366 3272 1645 3428 \n",
       "Q 1925 3584 2291 3584 \n",
       "Q 2894 3584 3203 3211 \n",
       "Q 3513 2838 3513 2113 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-74\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-72\" x=\"39.208984\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-61\" x=\"80.322266\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-69\" x=\"141.601562\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6e\" x=\"169.384766\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"line2d_27\">\n",
       "     <path d=\"M 52.78125 120.341406 \n",
       "L 62.78125 120.341406 \n",
       "L 72.78125 120.341406 \n",
       "\" style=\"fill: none; stroke-dasharray: 5.55,2.4; stroke-dashoffset: 0; stroke: #bf00bf; stroke-width: 1.5\"/>\n",
       "    </g>\n",
       "    <g id=\"text_15\">\n",
       "     <!-- valid -->\n",
       "     <g transform=\"translate(80.78125 123.841406) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-76\" d=\"M 191 3500 \n",
       "L 800 3500 \n",
       "L 1894 563 \n",
       "L 2988 3500 \n",
       "L 3597 3500 \n",
       "L 2284 0 \n",
       "L 1503 0 \n",
       "L 191 3500 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \n",
       "L 1178 4863 \n",
       "L 1178 0 \n",
       "L 603 0 \n",
       "L 603 4863 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-64\" d=\"M 2906 2969 \n",
       "L 2906 4863 \n",
       "L 3481 4863 \n",
       "L 3481 0 \n",
       "L 2906 0 \n",
       "L 2906 525 \n",
       "Q 2725 213 2448 61 \n",
       "Q 2172 -91 1784 -91 \n",
       "Q 1150 -91 751 415 \n",
       "Q 353 922 353 1747 \n",
       "Q 353 2572 751 3078 \n",
       "Q 1150 3584 1784 3584 \n",
       "Q 2172 3584 2448 3432 \n",
       "Q 2725 3281 2906 2969 \n",
       "z\n",
       "M 947 1747 \n",
       "Q 947 1113 1208 752 \n",
       "Q 1469 391 1925 391 \n",
       "Q 2381 391 2643 752 \n",
       "Q 2906 1113 2906 1747 \n",
       "Q 2906 2381 2643 2742 \n",
       "Q 2381 3103 1925 3103 \n",
       "Q 1469 3103 1208 2742 \n",
       "Q 947 2381 947 1747 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-76\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-61\" x=\"59.179688\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6c\" x=\"120.458984\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-69\" x=\"148.242188\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-64\" x=\"176.025391\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"line2d_28\">\n",
       "     <path d=\"M 52.78125 135.019531 \n",
       "L 62.78125 135.019531 \n",
       "L 72.78125 135.019531 \n",
       "\" style=\"fill: none; stroke-dasharray: 9.6,2.4,1.5,2.4; stroke-dashoffset: 0; stroke: #008000; stroke-width: 1.5\"/>\n",
       "    </g>\n",
       "    <g id=\"text_16\">\n",
       "     <!-- loss -->\n",
       "     <g transform=\"translate(80.78125 138.519531) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \n",
       "L 2834 2853 \n",
       "Q 2591 2978 2328 3040 \n",
       "Q 2066 3103 1784 3103 \n",
       "Q 1356 3103 1142 2972 \n",
       "Q 928 2841 928 2578 \n",
       "Q 928 2378 1081 2264 \n",
       "Q 1234 2150 1697 2047 \n",
       "L 1894 2003 \n",
       "Q 2506 1872 2764 1633 \n",
       "Q 3022 1394 3022 966 \n",
       "Q 3022 478 2636 193 \n",
       "Q 2250 -91 1575 -91 \n",
       "Q 1294 -91 989 -36 \n",
       "Q 684 19 347 128 \n",
       "L 347 722 \n",
       "Q 666 556 975 473 \n",
       "Q 1284 391 1588 391 \n",
       "Q 1994 391 2212 530 \n",
       "Q 2431 669 2431 922 \n",
       "Q 2431 1156 2273 1281 \n",
       "Q 2116 1406 1581 1522 \n",
       "L 1381 1569 \n",
       "Q 847 1681 609 1914 \n",
       "Q 372 2147 372 2553 \n",
       "Q 372 3047 722 3315 \n",
       "Q 1072 3584 1716 3584 \n",
       "Q 2034 3584 2315 3537 \n",
       "Q 2597 3491 2834 3397 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-6c\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6f\" x=\"27.783203\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-73\" x=\"88.964844\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-73\" x=\"141.064453\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"pf768b3c47b\">\n",
       "   <rect x=\"43.78125\" y=\"10.999219\" width=\"195.3\" height=\"138.6\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 350x250 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "d2l.plot(list(range(1, 100+1)), [train_acc, test_acc, train_loss], xlabel='epoch', ylabel='accuracy', xlim=[1,100], ylim=[0,1], legend=['train', 'valid', 'loss'])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.21"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
